/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved.
 * Description: UDK cycles/timer header file
 * Author: -
 * Create: 2021.4.19
 */

#ifndef UDK_CYCLES_H
#define UDK_CYCLES_H

#ifdef UDK_ARCH_ARM64
#include "arch/arm/udk_cycles.h"
#else
#include "arch/x86/udk_cycles.h"
#endif

uint64_t udk_get_tsc_hz(void);

static inline uint64_t udk_get_timer_cycles(void)
{
    return udk_rdtsc();
}

static inline uint64_t udk_get_timer_hz(void)
{
    return udk_get_tsc_hz();
}

void udk_delay_us(uint32_t us);
void udk_delay_ms(uint32_t ms);
int udk_timer_init(void);

#endif /* UDK_CYCLES_H */